from constants.recognition import RecognitionStrategy, TimeStrategy
from recognition import Recognition
import numpy as np

class Turnover(Recognition):

    def __init__(self):
        super().__init__()
        self.time_strategy = [TimeStrategy.TRADING.value]
        self.type = RecognitionStrategy.TURNOVER.value

    def recognize(self,data):
        tick=data.get('tick')
        klines=data.get('klines')
        volumes = klines["volume"].tail(3).tolist()
      
        max_volume  = max(volumes)

        if tick.get("volume") > max_volume  * 1.5:
            self.reminder(data)
            return True
        return False

    # def regression(self, data):
    #     quote = data.get('quote')
    #     open_price = quote.get('open')
    #     newest = quote.get('newest')

    #     if newest < open_price:
    #         return True
    #     return False